$(function () {

    var busuanzis = ['site_pv', 'page_pv', 'site_uv'];

    function hides() {
        busuanzis.map(function (bsz) {
            $('#busuanzi_container_' + bsz).hide();
        });
    }

    function texts(json) {
        busuanzis.map(function (bsz) {
            $('#busuanzi_value_' + bsz).text(json[bsz]);
        });
    }

    function shows() {
        busuanzis.map(function (bsz) {
            $('#busuanzi_container_' + bsz).show();
        });
    }

    hides();

    $.ajax({
        type: 'GET',
        url: '//service.ibruce.info/busuanzi',
        headers: {
            origin: '*',
            accept: 'application/vnd.busuanzi.v3+json'
        },
        timeout: 3000,
        dataType: 'jsonp',
        jsonp: 'jsonpCallback',
        success: function (data) {
            var values = eval(data);
            texts(values);
            shows();
        },
        error: function () {
            hides();
        }
    });

    // 统计response time


});